package day_2022_12_to_3.year2023;

/**
 * @author haomin
 * @date 2023/03/14 22:59
 **/
public class Day3_14_Num {
    class Solution {
        public int[][] restoreMatrix(int[] rowSum, int[] colSum) {
            int[][] res = new int[rowSum.length][colSum.length];
            for (int i = 0; i < rowSum.length; ++i) {
                for (int j = 0; j < colSum.length; ++j) {
                    res[i][j] = Math.min(colSum[j], rowSum[i]);
                    rowSum[i] -= res[i][j];
                    colSum[j] -= res[i][j];
                }
            }
            return res;
        }
    }
}